package com.meta.platform.company.dto;

import lombok.Data;

import java.lang.reflect.Field;

@Data
public class QueryCompanyDto {
    private String keyword;
    private String searchKey;
    private String provinceCode;
    private String cityCode;
    private Integer pageSize;
    private Integer pageIndex;

    public String toString(){

        StringBuilder builder = new StringBuilder();

        for (Field declaredField : this.getClass().getDeclaredFields()) {
            try {
                Object val = declaredField.get(this);
                if (val != null){
                    builder.append(declaredField.getName());
                    builder.append("=");
                    builder.append(val.toString());
                    builder.append("&");
                }
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }

        return builder.substring(0, builder.length() - 1);
    }
}
